package com.example.mobile2121606110syc0409homework;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity6 extends AppCompatActivity {

    private TextView tvMainTitle6;
    private TextView tvMainTit61;
    private TextView tvMainTit62;
    private TextView tvMainTit63;
    private EditText edtTtPN6;
    private Button btnMain6;
    private TextView tvMainTit64;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main6);
        initView();
        btnMain6.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int score = Integer.parseInt(edtTtPN6.getText().toString());
                if (score >= 90 ) {
                    tvMainTit64.setText("A");
                }else if (score >= 80){
                    tvMainTit64.setText("B");
                }
                else if (score >= 70){
                    tvMainTit64.setText("c");
                }
                else if (score >= 60){
                    tvMainTit64.setText("D");
                }else {
                    tvMainTit64.setText("E");
                }
            }
        });
    }

    private void initView() {
        tvMainTitle6 = (TextView) findViewById(R.id.tvMainTitle6);
        tvMainTit61 = (TextView) findViewById(R.id.tvMainTit61);
        tvMainTit62 = (TextView) findViewById(R.id.tvMainTit62);
        tvMainTit63 = (TextView) findViewById(R.id.tvMainTit63);
        edtTtPN6 = (EditText) findViewById(R.id.edtTtPN6);
        btnMain6 = (Button) findViewById(R.id.btnMain6);
        tvMainTit64 = (TextView) findViewById(R.id.tvMainTit64);
    }
}